package cn.sstir.hackathon.wrapper;

import cn.sgst.tool.common.page.Page;
import cn.sgst.tool.common.util.ToolUtil;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author: fli
 * @email: fli@sstir.cn
 * @date: 2020/1/16 21:05
 */
public class PaperWrapper extends BaseControllerWrapper {

    public PaperWrapper(List<Map<String, Object>> multi) {
        super(multi);
    }

    public PaperWrapper(Page<Map<String, Object>> pageResult) {
        super(pageResult);
    }

    @Override
    protected void wrapTheMap(Map<String, Object> map) {

        // 论文类型
        String scType = (String) map.get("sc_type");
        if (ToolUtil.isNotEmpty(scType)) {
            if (Objects.equals("1", scType)) {
                map.put("sc_type", "期刊");
            }
            if (Objects.equals("2", scType)) {
                map.put("sc_type", "学位论文");
            }
            if (Objects.equals("3", scType)) {
                map.put("sc_type", "会议论文");
            }
            if (Objects.equals("4", scType)) {
                map.put("sc_type", "书籍");
            }
        }

        String scAbstract = (String) map.get("sc_abstract");
        if(ToolUtil.isEmpty(scAbstract)){
            map.put("sc_abstract","暂无摘要");
        }
    }
}
